var scoreDom = $$('.el-card__body');
function getCurrScore() {
    var scoreStr = scoreDom[7].childNodes[2].childNodes[0].innerText;
    scoreStr = scoreStr.substr(scoreStr.indexOf('得分：') + '得分：'.length);
    scoreStr = scoreStr.replaceAll('分', '');
    // 累计得分
    console.log(scoreStr);
    return parseFloat(scoreStr);
}

// default: 40, 大英: 50
var nextClickIdx = 40;
var idx = 0, lastScore = 0, currScore = 0;
var chooseLabelDom = $$('.el-radio-group'), nextClickDom = $$('.el-form-item__content');
setInterval(() => {
    var labels = chooseLabelDom[idx].childNodes;
    var tidAry = [], right = false;
    labels.forEach((label, index) => {
        tidAry.push(setTimeout(() => {
            if (right === false) {
                label.click();

                tidAry.push(setTimeout(() => {
                    currScore = getCurrScore();
                    console.info("index: {}, lastScore: {}, currScore: {}", index, lastScore, currScore);
                    if (currScore > lastScore) {
                        console.info("取消所有任务")
                        tidAry.forEach((id, ix) => {
                            console.info("clear tid: {}", id)
                            clearTimeout(id);
                        });
                        
                        right = true;
                        idx++;
                        lastScore = currScore;
                        nextClickDom[nextClickIdx].childNodes[2].click()
                    }
                }, 300));
            }
        }, (index + 1) * 400));
    });
}, 4000);